﻿using Core;
using Core.Domain.Customers;
using Core.Domain.Logging;
using System;
using System.Collections.Generic;

namespace Services.Logging
{
    /// <summary>
    /// 日志服务接口
    /// </summary>
    public partial interface ILogger
    {
        /// <summary>
        /// 是否启用级别
        /// </summary>
        bool IsEnabled(LogLevel level);

        /// <summary>
        /// 删除一条日志
        /// </summary>
        /// <param name="log">Log item</param>
        void DeleteLog(Log log);

        /// <summary>
        /// 清除日志
        /// </summary>
        void ClearLog();

        /// <summary>
        /// 获取所有日志
        /// </summary>
        /// <param name="fromUtc">起始日</param>
        /// <param name="toUtc">结束日</param>
        /// <param name="message">消息</param>
        /// <param name="logLevel">日志级别</param>
        /// <param name="pageIndex">当前页</param>
        /// <param name="pageSize">页大小</param>
        IPagedList<Log> GetAllLogs(DateTime? fromUtc, DateTime? toUtc,
            string message, LogLevel? logLevel, int pageIndex, int pageSize);

        /// <summary>
        /// 根据主键获取日志
        /// </summary>
        Log GetLogById(int logId);

        /// <summary>
        /// 根据主键集合获取日志
        /// </summary>
        IList<Log> GetLogByIds(int[] logIds);

        /// <summary>
        /// 插入日志
        /// </summary>
        /// <param name="logLevel">日志级别</param>
        /// <param name="shortMessage">短消息</param>
        /// <param name="fullMessage">长消息</param>
        /// <param name="customer">操作用户</param>
        /// <returns></returns>
        Log InsertLog(LogLevel logLevel, string shortMessage, string fullMessage = "", Customer customer = null);
    }
}
